package com.hytc.mymall.activity.explain;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.hytc.mymall.R;
import com.hytc.mymall.adapter.UserAgreementAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by allkiss on 2016/12/8.
 */

public class UnionWelfareRankActivity extends Activity {

    @BindView(R.id.iv_title_left)
    ImageView ivTitleLeft;
    @BindView(R.id.rl_back)
    RelativeLayout rlBack;
    @BindView(R.id.toolbar_title)
    TextView toolbarTitle;
    @BindView(R.id.toolbar_title_arrow)
    ImageView toolbarTitleArrow;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.iv_mynews)
    ImageView ivMynews;
    @BindView(R.id.tv_info_commit)
    TextView tvInfoCommit;
    @BindView(R.id.rl_right)
    RelativeLayout rlRight;
    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.sv_content)
    ScrollView svContent;
    @BindView(R.id.ptrlv_unionwelfarerank)
    ListView ptrlvUnionwelfarerank;
    UserAgreementAdapter adapter;

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_unionwel);
        ButterKnife.bind(this);
        initView();
    }

    /**
     * 初始化数据
     */
    private void initView() {
        rlBack.setVisibility(View.VISIBLE);
        switch (getType()) {
            case 20:
                notice();
                break;
            case 21:
                userAgreement();

                break;
        }
    }

    /**
     * 用户须知
     */
    private void userAgreement() {
        toolbarTitle.setText("用户须知");
        svContent.setVisibility(View.VISIBLE);
    }

    /**
     * 用户须知
     */
    private void notice() {

        toolbarTitle.setText("通知·公告");
        adapter = new UserAgreementAdapter(this);
        ptrlvUnionwelfarerank.setVisibility(View.VISIBLE);
        ptrlvUnionwelfarerank.setAdapter(adapter);
    }

    private int getType() {
        return getIntent().getIntExtra("noticetype", 0);
    }

    @OnClick(R.id.rl_back)
    public void onClick() {
        finish();
    }
}
